# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gnome-control-center
pkgver=3.26.1
pkgrel=1
pkgdesc="GNOME's main interface to configure various aspects of the desktop"
url="https://git.gnome.org/browse/gnome-control-center"
license=(GPL2)
arch=(i686 x86_64)
depends=(accountsservice cups-pk-helper gnome-bluetooth gnome-desktop
         gnome-online-accounts gnome-settings-daemon gsettings-desktop-schemas gtk3
         libgtop libnm-gtk sound-theme-freedesktop upower libpwquality
         gnome-color-manager smbclient libmm-glib libgnomekbd grilo clutter-gtk libibus
         cheese libgudev)
makedepends=(intltool docbook-xsl modemmanager gnome-common git python)
optdepends=('system-config-printer: Printer settings'
            'gnome-user-share: Bluetooth and WebDAV file sharing'
            'rygel: media sharing'
            'vino: screen sharing'
            'openssh: remote login')
groups=(gnome)
options=('!emptydirs')
_commit=91983676e1421016127488d3a80f7707966878ae  # tags/GNOME_CONTROL_CENTER_3_26_1^0
source=("git+https://git.gnome.org/browse/gnome-control-center#commit=$_commit"
        "git+https://git.gnome.org/browse/libgnome-volume-control"
        "git+https://git.gnome.org/browse/libgd")
sha256sums=('SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^GNOME_CONTROL_CENTER_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname

  git submodule init
  git config --local submodule."panels/sound/gvc".url "$srcdir/libgnome-volume-control"
  git config --local submodule.libgd.url "$srcdir/libgd"
  git submodule update

  NOCONFIGURE=1 ./autogen.sh
}


build() {
  cd $pkgname

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
      --libexecdir=/usr/lib/$pkgname --disable-static

  #https://bugzilla.gnome.org/show_bug.cgi?id=656229
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' -e 's/    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then/      func_append compile_command " -Wl,-O1,--as-needed"\n      func_append finalize_command " -Wl,-O1,--as-needed"\n\0/' libtool

  make
}

package() {
  cd $pkgname

  make DESTDIR="$pkgdir" install

  install -d -o root -g 102 -m 750 "$pkgdir/usr/share/polkit-1/rules.d"
}
